package com.h3bpm.web.organization.controller;

import OThinker.H3.Controller.ControllerBase;
import com.h3bpm.web.organization.service.OrganizationSyncService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @authormi
 * @date2019/8/29
 */
@RestController
@RequestMapping("/Portal/OrganizationSyncController")
public class OrganizationSyncController extends ControllerBase {
    @Override
    public String getFunctionCode() {
        return null;
    }

    @Autowired
    OrganizationSyncService organizationSyncService;


    @RequestMapping("/OrgSync")
    public String organizationSync(){

        String result = organizationSyncService.syncDepartmentService();
        String resultUser =  organizationSyncService.syncUserService();
        String resultManage =  organizationSyncService.syncUserManager();
        try {
            getEngine().getOrganization().Reload();
        } catch (Exception e) {
            e.printStackTrace();
        }
        if("200".equals(result)  &&  "200".equals(resultManage) ){
               // return "redirect:/Portal/index.html#/app/HRSystem/BizQueryView/timingSynchronousOrg/timeList/orgSync";
           return  "200";
        }else{
            return "500";
        }
    }



}
